/**
 * JAVACC DEMO 1.0
 */
package com.apache.uct.util;

import com.apache.uct.common.ToolsUtil;

/**
 * description:
 *
 */
public class UctStringUtil {

    /**
     * 属性值生成,符合骆驼命名
     *
     * @param str
     * @return
     */
    public static String toCamelNamed(String str) {
        if (ToolsUtil.isNull(str))
            return "";
        String names[] = str.split("_");
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < names.length; i++) {
            if (i == 0) {
                sb.append(names[i].toLowerCase());
            } else {
                sb.append(names[i].substring(0, 1).toUpperCase() + names[i].substring(1)
                        .toLowerCase());
            }
        }
        return sb.toString();
    }

    /**
     * description:  返回用户类型
     *
     * @param sysEname
     * @param delStatus
     */
    public static String getSysFlag(String sysEname, String delStatus) {
        if (ToolsUtil.isNull(sysEname) && ("F".equals(delStatus) || "T".equals(delStatus)))
            return "0";
        else if ("1".equals(sysEname) && ("F".equals(delStatus) || "T".equals(delStatus)))
            return "1";
        else if ("0".equals(sysEname) && ("F".equals(delStatus) || "T".equals(delStatus))) {
            return "0";
        } else
            return delStatus;
    }
}
